package deco

type HttpClient struct {
	Timeout int
	MaxIdle int
	ErrCallBack func(error)
}
type ClientOption func(client *HttpClient)
type ClientOptions []ClientOption

func (this ClientOptions) aply(u *HttpClient) {
	for _,v:=range this{
		v(u)
	}
}
func NewHttpClient(opts... ClientOption) *HttpClient {
	u:=&HttpClient{}
	ClientOptions(opts).aply(u)
	return u

}
func WithTimeout(time int)ClientOption{
	return func(client *HttpClient) {
		client.Timeout=time
	}
}
func WithMaxIdle(max int)ClientOption{
	return func(client *HttpClient) {
		client.MaxIdle=max
	}
}
